import Collection from './base'

export const Users = new Collection({
  name: 'users',
  publish: [{
    name: 'users.login',
    callback (params) {
      return Users.find(params)
    }
  }, {
    name: 'users.login_by_token',
    callback (params) {
      return Users.find(params, {
        fields: {
          username: true
        }
      })
    }
  }],
  schema: {
    username: { type: String },
    password: { type: String }
  }
})
